const http = (obj) => {
  return new Promise((resolve, reject) => {
    wx.request({
      url: obj.url,
      method: obj.method || 'GET',
      data: obj.data || {},
      header: obj.header || {
        'content-type': 'application/json'
      },
      success: (res) => {
        resolve(res)
      },
      fail: (err) => {
        reject(err)
      }
    })
  })
}

export default http